package admin.shell.commands;

import admin.exceptions.*;
import admin.ui.ProxyMediator;

public class DeleteCommand extends ShellCommand {

	@Override
	public void execute(ProxyMediator proxy, String[] parameters) {
		if (parameters.length != 2) {
			System.out.println("Usage: delete <login>");
			return;
		}
		
		String login = parameters[1];
			
		try {
			proxy.removeAccount(login);
			System.out.println("Account deleted.");
		} catch (UnknownUserException e) {
			System.out.println("Error: Account deletion failed: User doesn't exist.");
		} catch (InsufficientPermissionsException e) {
			System.out.println("Error: Account deletion failed: Insufficient permissions to remove an account");
		}
	}
}
